Segmenting definition and logic

ECO makes it easy to define models. To reuse a model, simply import an ecopkg.

Segmenting 1.png

This will make the package part of your model and you can edit its contents. Code generation will also create new code and empty stubs for code-implemented operations.

You usually want to reuse the whole model assembly that may contain code-implemented operations, maybe code-derived attributes and relations, and so on.

To do this, choose the “Edit referenced packages” option instead:

Segmenting 2.png

Then choose “Add” and find an ecopkg you want to use as part of your complete model:

Segmenting 3.png

In this post, I chose the EcoAspProvider.ecopkg that comes with the ECO install. This package implements the membership functions for ASP.NET as eco objects.

When referencing a package like this, the classes in the package are made read-only. You can still draw associations to and from the classes in referenced packages as long as the association end is not embedded in any read-only end. In other words: you can point out read-only classes, but you cannot make a read-only class point out anything new. Give this some thought and you will probably find it very intuitive; the external, referenced, definition cannot be changed in this context.

A referenced package is NOT code generated with the rest of the model. The referenced package probably comes with a compiled assembly or project of its own that uses the definition in runtime. Add a reference to this as you would do with any other externally defined logic in .net:

Segmenting 4.png

If you try to change a property of a referred package, ECO will stop you: 

Segmenting 5.png

To solve this, use the referred package. You must click the choose package icon in the ecospace designer.

Segmenting 6.png

Then make sure that all packages you want to use are selected:

Segmenting 7.png

Ensure you generate code and build your solution before you generate the schema (the schema is derived from the runtime model that is derived by looking at the code alone).

Selected UML packages just means that your packages are available at runtime, and to ensure that they are the designer creates a reference to them in designer.cs code. You can add this reference your self if you have trouble to operate the designer for any reason. It takes this form:

    protected MDrivenPackage1.MDrivenPackage1Package IncludeEcoPackage_MDrivenPackage1_MDrivenPackage1Package;

It is just the package type used by a protected class member with a unique name. If you have several packages you need one member each. The member goes anywhere on the EcoSpace class

This page was edited 82 days ago on 08/27/2024. What links here